//
//  TheOrderDetailsTimeTableViewCell.m
//  BaseFrame
//
//  Created by 吕金状 on 2017/9/11.
//  Copyright © 2017年 com.mxh. All rights reserved.
//

#import "TheOrderDetailsTimeTableViewCell.h"


@interface TheOrderDetailsTimeTableViewCell ()

Strong UILabel *titleLabel;
Strong UILabel *timeLabel;
Strong UIView *lineView;
Strong UIView *line1View;

@end

@implementation TheOrderDetailsTimeTableViewCell

- (id)initWithCellIdentifier:(NSString *)cellID{
    self = [super initWithCellIdentifier:cellID];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        _titleLabel  = [[UILabel alloc]init];
        _titleLabel.font = DEF_FontSize_14;
        _titleLabel.textColor = getColor(textColor);
        _titleLabel.numberOfLines = 0;
        [self.contentView addSubview:_titleLabel];
        
        _timeLabel  = [[UILabel alloc]init];
        _timeLabel.font = DEF_FontSize_14;
        _timeLabel.textColor = getColor(textColor);
        _timeLabel.textAlignment = NSTextAlignmentRight;
        _timeLabel.numberOfLines = 0;
        [self.contentView addSubview:_timeLabel];
        
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = getColor(dividerColor);
//        [self.contentView addSubview:_lineView];
        
        _line1View = [[UIView alloc]init];
        _line1View.backgroundColor = getColor(dividerColor);
        [self.contentView addSubview:_line1View];
        [self layoutFrame];
    }
    return self;
}

- (void)layoutFrame{
    __weak __typeof(self)weakSelf = self;
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20 / WIDTH_5S_SCALE);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-20 / WIDTH_5S_SCALE);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
//    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(0 / WIDTH_5S_SCALE);
//        make.bottom.mas_equalTo(0);
//        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH - 0 / WIDTH_5S_SCALE, 0.5));
//    }];
    
    [self.line1View mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0 / WIDTH_5S_SCALE);
        make.top.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH - 0 / WIDTH_5S_SCALE, 0.5));
    }];
    
}

- (void)setModel:(NSDictionary *)model{
    _model = model;
//    self.titleLabel.text = model[@""];
//    self.timeLabel.text = model[@""];
    self.titleLabel.text = @"下单时间\n付款时间";
    self.timeLabel.text = [NSString stringWithFormat:@"%@\n%@",[model[@"order_time"] substringToIndex:19],[model[@"payment_time"] substringToIndex:19]];
}


@end
